package com.gitee.cirnochat.common.utils;

/**
 * 验证码工具类
 */
public final class VerifyCodeUtils {
    private VerifyCodeUtils() {
        throw new UnsupportedOperationException("Utility class");
    }

    /**
     * 生成验证码
     * @param length 验证码长度
     * @return 生成的验证码
     */
    public static String generateNumericCode(int length) {
        if (length <= 0) {
            throw new IllegalArgumentException("Length must be greater than 0");
        }
        StringBuilder code = new StringBuilder(length);
        for (int i = 0; i < length; i++) {
            code.append((int) (Math.random() * 10));
        }
        return code.toString();
    }
}
